// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A folder in an organization's resource hierarchy, used to
/// organize that organization's resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Folder {
    /// Output only. The resource name of the folder.
    /// Its format is `folders/{folder_id}`, for example: "folders/1234".
    pub name: std::string::String,

    /// Required. The folder's parent's resource name.
    /// Updates to the folder's parent must be performed using
    /// [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder].
    ///
    /// [google.cloud.resourcemanager.v3.Folders.MoveFolder]: crate::client::Folders::move_folder
    pub parent: std::string::String,

    /// The folder's display name.
    /// A folder's display name must be unique amongst its siblings. For example,
    /// no two folders with the same parent can share the same display name.
    /// The display name must start and end with a letter or digit, may contain
    /// letters, digits, spaces, hyphens and underscores and can be no longer
    /// than 30 characters. This is captured by the regular expression:
    /// `[\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?`.
    pub display_name: std::string::String,

    /// Output only. The lifecycle state of the folder.
    /// Updates to the state must be performed using
    /// [DeleteFolder][google.cloud.resourcemanager.v3.Folders.DeleteFolder] and
    /// [UndeleteFolder][google.cloud.resourcemanager.v3.Folders.UndeleteFolder].
    ///
    /// [google.cloud.resourcemanager.v3.Folders.DeleteFolder]: crate::client::Folders::delete_folder
    /// [google.cloud.resourcemanager.v3.Folders.UndeleteFolder]: crate::client::Folders::undelete_folder
    pub state: crate::model::folder::State,

    /// Output only. Timestamp when the folder was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the folder was last modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the folder was requested to be deleted.
    pub delete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. A checksum computed by the server based on the current value
    /// of the folder resource. This may be sent on update and delete requests to
    /// ensure the client has an up-to-date value before proceeding.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Folder {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Folder::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::Folder::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Folder::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Folder::state].
    pub fn set_state<T: std::convert::Into<crate::model::folder::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Folder::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Folder::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Folder::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Folder::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [delete_time][crate::model::Folder::delete_time].
    pub fn set_delete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [delete_time][crate::model::Folder::delete_time].
    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::Folder::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for Folder {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.Folder"
    }
}

/// Defines additional types related to [Folder].
pub mod folder {
    #[allow(unused_imports)]
    use super::*;

    /// Folder lifecycle states.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// The normal and active state.
        Active,
        /// The folder has been marked for deletion by the user.
        DeleteRequested,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::DeleteRequested => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::DeleteRequested => std::option::Option::Some("DELETE_REQUESTED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "DELETE_REQUESTED" => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::DeleteRequested => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.resourcemanager.v3.Folder.State",
            ))
        }
    }
}

/// The GetFolder request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFolderRequest {
    /// Required. The resource name of the folder to retrieve.
    /// Must be of the form `folders/{folder_id}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetFolderRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetFolderRequest"
    }
}

/// The ListFolders request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFoldersRequest {
    /// Required. The name of the parent resource whose folders are being listed.
    /// Only children of this parent resource are listed; descendants are not
    /// listed.
    ///
    /// If the parent is a folder, use the value `folders/{folder_id}`. If the
    /// parent is an organization, use the value `organizations/{org_id}`.
    ///
    /// Access to this method is controlled by checking the
    /// `resourcemanager.folders.list` permission on the `parent`.
    pub parent: std::string::String,

    /// Optional. The maximum number of folders to return in the response. The
    /// server can return fewer folders than requested. If unspecified, server
    /// picks an appropriate default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to `ListFolders`
    /// that indicates where this listing should continue from.
    pub page_token: std::string::String,

    /// Optional. Controls whether folders in the
    /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
    /// state should be returned. Defaults to false.
    ///
    /// [google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]: crate::model::folder::State::DeleteRequested
    pub show_deleted: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFoldersRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListFoldersRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListFoldersRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListFoldersRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [show_deleted][crate::model::ListFoldersRequest::show_deleted].
    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.show_deleted = v.into();
        self
    }
}

impl wkt::message::Message for ListFoldersRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListFoldersRequest"
    }
}

/// The ListFolders response message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFoldersResponse {
    /// A possibly paginated list of folders that are direct descendants of
    /// the specified parent resource.
    pub folders: std::vec::Vec<crate::model::Folder>,

    /// A pagination token returned from a previous call to `ListFolders`
    /// that indicates from where listing should continue.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFoldersResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [folders][crate::model::ListFoldersResponse::folders].
    pub fn set_folders<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Folder>,
    {
        use std::iter::Iterator;
        self.folders = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListFoldersResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListFoldersResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListFoldersResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListFoldersResponse {
    type PageItem = crate::model::Folder;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.folders
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for searching folders.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchFoldersRequest {
    /// Optional. The maximum number of folders to return in the response. The
    /// server can return fewer folders than requested. If unspecified, server
    /// picks an appropriate default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `SearchFolders` that indicates from where search should continue.
    pub page_token: std::string::String,

    /// Optional. Search criteria used to select the folders to return.
    /// If no search criteria is specified then all accessible folders will be
    /// returned.
    ///
    /// Query expressions can be used to restrict results based upon displayName,
    /// state and parent, where the operators `=` (`:`) `NOT`, `AND` and `OR`
    /// can be used along with the suffix wildcard symbol `*`.
    ///
    /// The `displayName` field in a query expression should use escaped quotes
    /// for values that include whitespace to prevent unexpected behavior.
    ///
    /// ```norust
    /// | Field                   | Description                            |
    /// |-------------------------|----------------------------------------|
    /// | displayName             | Filters by displayName.                |
    /// | parent                  | Filters by parent (for example: folders/123). |
    /// | state, lifecycleState   | Filters by state.                      |
    /// ```
    ///
    /// Some example queries are:
    ///
    /// * Query `displayName=Test*` returns Folder resources whose display name
    ///   starts with "Test".
    /// * Query `state=ACTIVE` returns Folder resources with
    ///   `state` set to `ACTIVE`.
    /// * Query `parent=folders/123` returns Folder resources that have
    ///   `folders/123` as a parent resource.
    /// * Query `parent=folders/123 AND state=ACTIVE` returns active
    ///   Folder resources that have `folders/123` as a parent resource.
    /// * Query `displayName=\\"Test String\\"` returns Folder resources with
    ///   display names that include both "Test" and "String".
    pub query: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchFoldersRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [page_size][crate::model::SearchFoldersRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::SearchFoldersRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [query][crate::model::SearchFoldersRequest::query].
    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.query = v.into();
        self
    }
}

impl wkt::message::Message for SearchFoldersRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchFoldersRequest"
    }
}

/// The response message for searching folders.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchFoldersResponse {
    /// A possibly paginated folder search results.
    /// the specified parent resource.
    pub folders: std::vec::Vec<crate::model::Folder>,

    /// A pagination token returned from a previous call to `SearchFolders`
    /// that indicates from where searching should continue.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchFoldersResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [folders][crate::model::SearchFoldersResponse::folders].
    pub fn set_folders<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Folder>,
    {
        use std::iter::Iterator;
        self.folders = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::SearchFoldersResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchFoldersResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchFoldersResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for SearchFoldersResponse {
    type PageItem = crate::model::Folder;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.folders
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The CreateFolder request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateFolderRequest {
    /// Required. The folder being created, only the display name and parent will
    /// be consulted. All other fields will be ignored.
    pub folder: std::option::Option<crate::model::Folder>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [folder][crate::model::CreateFolderRequest::folder].
    pub fn set_folder<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Folder>,
    {
        self.folder = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [folder][crate::model::CreateFolderRequest::folder].
    pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Folder>,
    {
        self.folder = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateFolderRequest"
    }
}

/// Metadata pertaining to the Folder creation process.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateFolderMetadata {
    /// The display name of the folder.
    pub display_name: std::string::String,

    /// The resource name of the folder or organization we are creating the folder
    /// under.
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateFolderMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::CreateFolderMetadata::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::CreateFolderMetadata::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for CreateFolderMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateFolderMetadata"
    }
}

/// The request sent to the
/// [UpdateFolder][google.cloud.resourcemanager.v3.Folder.UpdateFolder]
/// method.
///
/// Only the `display_name` field can be changed. All other fields will be
/// ignored. Use the
/// [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder] method to
/// change the `parent` field.
///
/// [google.cloud.resourcemanager.v3.Folders.MoveFolder]: crate::client::Folders::move_folder
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFolderRequest {
    /// Required. The new definition of the Folder. It must include the `name`
    /// field, which cannot be changed.
    pub folder: std::option::Option<crate::model::Folder>,

    /// Required. Fields to be updated.
    /// Only the `display_name` can be updated.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [folder][crate::model::UpdateFolderRequest::folder].
    pub fn set_folder<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Folder>,
    {
        self.folder = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [folder][crate::model::UpdateFolderRequest::folder].
    pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Folder>,
    {
        self.folder = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateFolderRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateFolderRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateFolderRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by UpdateFolder.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFolderMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateFolderMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UpdateFolderMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateFolderMetadata"
    }
}

/// The MoveFolder request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveFolderRequest {
    /// Required. The resource name of the Folder to move.
    /// Must be of the form folders/{folder_id}
    pub name: std::string::String,

    /// Required. The resource name of the folder or organization which should be
    /// the folder's new parent. Must be of the form `folders/{folder_id}` or
    /// `organizations/{org_id}`.
    pub destination_parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MoveFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::MoveFolderRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination_parent][crate::model::MoveFolderRequest::destination_parent].
    pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_parent = v.into();
        self
    }
}

impl wkt::message::Message for MoveFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.MoveFolderRequest"
    }
}

/// Metadata pertaining to the folder move process.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveFolderMetadata {
    /// The display name of the folder.
    pub display_name: std::string::String,

    /// The resource name of the folder's parent.
    pub source_parent: std::string::String,

    /// The resource name of the folder or organization to move the folder to.
    pub destination_parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MoveFolderMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::MoveFolderMetadata::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [source_parent][crate::model::MoveFolderMetadata::source_parent].
    pub fn set_source_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.source_parent = v.into();
        self
    }

    /// Sets the value of [destination_parent][crate::model::MoveFolderMetadata::destination_parent].
    pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_parent = v.into();
        self
    }
}

impl wkt::message::Message for MoveFolderMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.MoveFolderMetadata"
    }
}

/// The DeleteFolder request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteFolderRequest {
    /// Required. The resource name of the folder to be deleted.
    /// Must be of the form `folders/{folder_id}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteFolderRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteFolderRequest"
    }
}

/// A status object which is used as the `metadata` field for the `Operation`
/// returned by `DeleteFolder`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteFolderMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteFolderMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteFolderMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteFolderMetadata"
    }
}

/// The UndeleteFolder request message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteFolderRequest {
    /// Required. The resource name of the folder to undelete.
    /// Must be of the form `folders/{folder_id}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteFolderRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UndeleteFolderRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for UndeleteFolderRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UndeleteFolderRequest"
    }
}

/// A status object which is used as the `metadata` field for the `Operation`
/// returned by `UndeleteFolder`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteFolderMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteFolderMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UndeleteFolderMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UndeleteFolderMetadata"
    }
}

/// The root node in the resource hierarchy to which a particular entity's
/// (a company, for example) resources belong.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Organization {
    /// Output only. The resource name of the organization. This is the
    /// organization's relative path in the API. Its format is
    /// "organizations/[organization_id]". For example, "organizations/1234".
    pub name: std::string::String,

    /// Output only. A human-readable string that refers to the organization in the
    /// Google Cloud Console. This string is set by the server and cannot be
    /// changed. The string will be set to the primary domain (for example,
    /// "google.com") of the Google Workspace customer that owns the organization.
    pub display_name: std::string::String,

    /// Output only. The organization's current lifecycle state.
    pub state: crate::model::organization::State,

    /// Output only. Timestamp when the Organization was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the Organization was last modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the Organization was requested for deletion.
    pub delete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. A checksum computed by the server based on the current value
    /// of the Organization resource. This may be sent on update and delete
    /// requests to ensure the client has an up-to-date value before proceeding.
    pub etag: std::string::String,

    /// The owner of this organization. The owner should be specified on
    /// creation. Once set, it cannot be changed.
    ///
    /// The lifetime of the organization and all of its descendants are bound to
    /// the owner. If the owner is deleted, the organization and all its
    /// descendants will be deleted.
    pub owner: std::option::Option<crate::model::organization::Owner>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Organization {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Organization::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Organization::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Organization::state].
    pub fn set_state<T: std::convert::Into<crate::model::organization::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Organization::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Organization::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Organization::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Organization::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [delete_time][crate::model::Organization::delete_time].
    pub fn set_delete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [delete_time][crate::model::Organization::delete_time].
    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::Organization::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [owner][crate::model::Organization::owner].
    ///
    /// Note that all the setters affecting `owner` are mutually
    /// exclusive.
    pub fn set_owner<
        T: std::convert::Into<std::option::Option<crate::model::organization::Owner>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.owner = v.into();
        self
    }

    /// The value of [owner][crate::model::Organization::owner]
    /// if it holds a `DirectoryCustomerId`, `None` if the field is not set or
    /// holds a different branch.
    pub fn directory_customer_id(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.owner.as_ref().and_then(|v| match v {
            crate::model::organization::Owner::DirectoryCustomerId(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [owner][crate::model::Organization::owner]
    /// to hold a `DirectoryCustomerId`.
    ///
    /// Note that all the setters affecting `owner` are
    /// mutually exclusive.
    pub fn set_directory_customer_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.owner = std::option::Option::Some(
            crate::model::organization::Owner::DirectoryCustomerId(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Organization {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.Organization"
    }
}

/// Defines additional types related to [Organization].
pub mod organization {
    #[allow(unused_imports)]
    use super::*;

    /// Organization lifecycle states.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.  This is only useful for distinguishing unset values.
        Unspecified,
        /// The normal and active state.
        Active,
        /// The organization has been marked for deletion by the user.
        DeleteRequested,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::DeleteRequested => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::DeleteRequested => std::option::Option::Some("DELETE_REQUESTED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "DELETE_REQUESTED" => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::DeleteRequested => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.resourcemanager.v3.Organization.State",
            ))
        }
    }

    /// The owner of this organization. The owner should be specified on
    /// creation. Once set, it cannot be changed.
    ///
    /// The lifetime of the organization and all of its descendants are bound to
    /// the owner. If the owner is deleted, the organization and all its
    /// descendants will be deleted.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Owner {
        /// Immutable. The G Suite / Workspace customer id used in the Directory API.
        DirectoryCustomerId(std::string::String),
    }
}

/// The request sent to the `GetOrganization` method. The `name` field is
/// required. `organization_id` is no longer accepted.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetOrganizationRequest {
    /// Required. The resource name of the Organization to fetch. This is the
    /// organization's relative path in the API, formatted as
    /// "organizations/[organizationId]". For example, "organizations/1234".
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetOrganizationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetOrganizationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetOrganizationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetOrganizationRequest"
    }
}

/// The request sent to the `SearchOrganizations` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchOrganizationsRequest {
    /// Optional. The maximum number of organizations to return in the response.
    /// The server can return fewer organizations than requested. If unspecified,
    /// server picks an appropriate default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `SearchOrganizations` that indicates from where listing should continue.
    pub page_token: std::string::String,

    /// Optional. An optional query string used to filter the Organizations to
    /// return in the response. Query rules are case-insensitive.
    ///
    /// ```norust
    /// | Field            | Description                                |
    /// |------------------|--------------------------------------------|
    /// | directoryCustomerId, owner.directoryCustomerId | Filters by directory
    /// customer id. |
    /// | domain           | Filters by domain.                         |
    /// ```
    ///
    /// Organizations may be queried by `directoryCustomerId` or by
    /// `domain`, where the domain is a G Suite domain, for example:
    ///
    /// * Query `directorycustomerid:123456789` returns Organization
    ///   resources with `owner.directory_customer_id` equal to `123456789`.
    /// * Query `domain:google.com` returns Organization resources corresponding
    ///   to the domain `google.com`.
    pub query: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchOrganizationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [page_size][crate::model::SearchOrganizationsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::SearchOrganizationsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [query][crate::model::SearchOrganizationsRequest::query].
    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.query = v.into();
        self
    }
}

impl wkt::message::Message for SearchOrganizationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchOrganizationsRequest"
    }
}

/// The response returned from the `SearchOrganizations` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchOrganizationsResponse {
    /// The list of Organizations that matched the search query, possibly
    /// paginated.
    pub organizations: std::vec::Vec<crate::model::Organization>,

    /// A pagination token to be used to retrieve the next page of results. If the
    /// result is too large to fit within the page size specified in the request,
    /// this field will be set with a token that can be used to fetch the next page
    /// of results. If this field is empty, it indicates that this response
    /// contains the last page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchOrganizationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [organizations][crate::model::SearchOrganizationsResponse::organizations].
    pub fn set_organizations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Organization>,
    {
        use std::iter::Iterator;
        self.organizations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::SearchOrganizationsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchOrganizationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchOrganizationsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for SearchOrganizationsResponse {
    type PageItem = crate::model::Organization;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.organizations
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A status object which is used as the `metadata` field for the operation
/// returned by DeleteOrganization.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteOrganizationMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteOrganizationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteOrganizationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteOrganizationMetadata"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by UndeleteOrganization.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteOrganizationMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteOrganizationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UndeleteOrganizationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UndeleteOrganizationMetadata"
    }
}

/// A project is a high-level Google Cloud entity. It is a
/// container for ACLs, APIs, App Engine Apps, VMs, and other
/// Google Cloud Platform resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Project {
    /// Output only. The unique resource name of the project. It is an int64
    /// generated number prefixed by "projects/".
    ///
    /// Example: `projects/415104041262`
    pub name: std::string::String,

    /// Optional. A reference to a parent Resource. eg., `organizations/123` or
    /// `folders/876`.
    pub parent: std::string::String,

    /// Immutable. The unique, user-assigned id of the project.
    /// It must be 6 to 30 lowercase ASCII letters, digits, or hyphens.
    /// It must start with a letter.
    /// Trailing hyphens are prohibited.
    ///
    /// Example: `tokyo-rain-123`
    pub project_id: std::string::String,

    /// Output only. The project lifecycle state.
    pub state: crate::model::project::State,

    /// Optional. A user-assigned display name of the project.
    /// When present it must be between 4 to 30 characters.
    /// Allowed characters are: lowercase and uppercase letters, numbers,
    /// hyphen, single-quote, double-quote, space, and exclamation point.
    ///
    /// Example: `My Project`
    pub display_name: std::string::String,

    /// Output only. Creation time.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The most recent time this resource was modified.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time at which this resource was requested for deletion.
    pub delete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. A checksum computed by the server based on the current value
    /// of the Project resource. This may be sent on update and delete requests to
    /// ensure the client has an up-to-date value before proceeding.
    pub etag: std::string::String,

    /// Optional. The labels associated with this project.
    ///
    /// Label keys must be between 1 and 63 characters long and must conform
    /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?.
    ///
    /// Label values must be between 0 and 63 characters long and must conform
    /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?.
    ///
    /// No more than 64 labels can be associated with a given resource.
    ///
    /// Clients should store labels in a representation such as JSON that does not
    /// depend on specific characters being disallowed.
    ///
    /// Example: `"myBusinessDimension" : "businessValue"`
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Project {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Project::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::Project::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::Project::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Project::state].
    pub fn set_state<T: std::convert::Into<crate::model::project::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Project::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Project::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Project::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Project::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Project::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [delete_time][crate::model::Project::delete_time].
    pub fn set_delete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [delete_time][crate::model::Project::delete_time].
    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::Project::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::Project::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for Project {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.Project"
    }
}

/// Defines additional types related to [Project].
pub mod project {
    #[allow(unused_imports)]
    use super::*;

    /// Project lifecycle states.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.  This is only used/useful for distinguishing
        /// unset values.
        Unspecified,
        /// The normal and active state.
        Active,
        /// The project has been marked for deletion by the user
        /// (by invoking
        /// [DeleteProject][google.cloud.resourcemanager.v3.Projects.DeleteProject])
        /// or by the system (Google Cloud Platform).
        /// This can generally be reversed by invoking [UndeleteProject]
        /// [google.cloud.resourcemanager.v3.Projects.UndeleteProject].
        ///
        /// [google.cloud.resourcemanager.v3.Projects.DeleteProject]: crate::client::Projects::delete_project
        DeleteRequested,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::DeleteRequested => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::DeleteRequested => std::option::Option::Some("DELETE_REQUESTED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "DELETE_REQUESTED" => Self::DeleteRequested,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::DeleteRequested => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.resourcemanager.v3.Project.State",
            ))
        }
    }
}

/// The request sent to the
/// [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.GetProject]: crate::client::Projects::get_project
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProjectRequest {
    /// Required. The name of the project (for example, `projects/415104041262`).
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProjectRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetProjectRequest"
    }
}

/// The request sent to the
/// [ListProjects][google.cloud.resourcemanager.v3.Projects.ListProjects]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.ListProjects]: crate::client::Projects::list_projects
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProjectsRequest {
    /// Required. The name of the parent resource whose projects are being listed.
    /// Only children of this parent resource are listed; descendants are not
    /// listed.
    ///
    /// If the parent is a folder, use the value `folders/{folder_id}`. If the
    /// parent is an organization, use the value `organizations/{org_id}`.
    pub parent: std::string::String,

    /// Optional. A pagination token returned from a previous call to
    /// [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that
    /// indicates from where listing should continue.
    pub page_token: std::string::String,

    /// Optional. The maximum number of projects to return in the response.
    /// The server can return fewer projects than requested.
    /// If unspecified, server picks an appropriate default.
    pub page_size: i32,

    /// Optional. Indicate that projects in the `DELETE_REQUESTED` state should
    /// also be returned. Normally only `ACTIVE` projects are returned.
    pub show_deleted: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProjectsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListProjectsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProjectsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProjectsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [show_deleted][crate::model::ListProjectsRequest::show_deleted].
    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.show_deleted = v.into();
        self
    }
}

impl wkt::message::Message for ListProjectsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListProjectsRequest"
    }
}

/// A page of the response received from the
/// [ListProjects][google.cloud.resourcemanager.v3.Projects.ListProjects]
/// method.
///
/// A paginated response where more pages are available has
/// `next_page_token` set. This token can be used in a subsequent request to
/// retrieve the next request page.
///
/// NOTE: A response may contain fewer elements than the request `page_size` and
/// still have a `next_page_token`.
///
/// [google.cloud.resourcemanager.v3.Projects.ListProjects]: crate::client::Projects::list_projects
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProjectsResponse {
    /// The list of Projects under the parent. This list can be paginated.
    pub projects: std::vec::Vec<crate::model::Project>,

    /// Pagination token.
    ///
    /// If the result set is too large to fit in a single response, this token
    /// is returned. It encodes the position of the current result cursor.
    /// Feeding this value into a new list request with the `page_token` parameter
    /// gives the next page of the results.
    ///
    /// When `next_page_token` is not filled in, there is no next page and
    /// the list returned is the last page in the result set.
    ///
    /// Pagination tokens have a limited lifetime.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProjectsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [projects][crate::model::ListProjectsResponse::projects].
    pub fn set_projects<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Project>,
    {
        use std::iter::Iterator;
        self.projects = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProjectsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProjectsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListProjectsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProjectsResponse {
    type PageItem = crate::model::Project;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.projects
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request sent to the
/// [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.SearchProjects]: crate::client::Projects::search_projects
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchProjectsRequest {
    /// Optional. A query string for searching for projects that the caller has
    /// `resourcemanager.projects.get` permission to. If multiple fields are
    /// included in the query, then it will return results that match any of the
    /// fields. Some eligible fields are:
    ///
    /// - **`displayName`, `name`**: Filters by displayName.
    /// - **`parent`**: Project's parent (for example: `folders/123`,
    ///   `organizations/*`). Prefer `parent` field over `parent.type` and
    ///   `parent.id`.
    /// - **`parent.type`**: Parent's type: `folder` or `organization`.
    /// - **`parent.id`**: Parent's id number (for example: `123`).
    /// - **`id`, `projectId`**: Filters by projectId.
    /// - **`state`, `lifecycleState`**: Filters by state.
    /// - **`labels`**: Filters by label name or value.
    /// - **`labels.<key>` (where `<key>` is the name of a label)**: Filters by label
    ///   name.
    ///
    /// Search expressions are case insensitive.
    ///
    /// Some examples queries:
    ///
    /// - **`name:how*`**: The project's name starts with "how".
    /// - **`name:Howl`**: The project's name is `Howl` or `howl`.
    /// - **`name:HOWL`**: Equivalent to above.
    /// - **`NAME:howl`**: Equivalent to above.
    /// - **`labels.color:*`**: The project has the label `color`.
    /// - **`labels.color:red`**:  The project's label `color` has the value `red`.
    /// - **`labels.color:red labels.size:big`**: The project's label `color` has
    ///   the value `red` or its label `size` has the value `big`.
    ///
    /// If no query is specified, the call will return projects for which the user
    /// has the `resourcemanager.projects.get` permission.
    pub query: std::string::String,

    /// Optional. A pagination token returned from a previous call to
    /// [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects] that
    /// indicates from where listing should continue.
    pub page_token: std::string::String,

    /// Optional. The maximum number of projects to return in the response.
    /// The server can return fewer projects than requested.
    /// If unspecified, server picks an appropriate default.
    pub page_size: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchProjectsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [query][crate::model::SearchProjectsRequest::query].
    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.query = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::SearchProjectsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::SearchProjectsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }
}

impl wkt::message::Message for SearchProjectsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchProjectsRequest"
    }
}

/// A page of the response received from the
/// [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
/// method.
///
/// A paginated response where more pages are available has
/// `next_page_token` set. This token can be used in a subsequent request to
/// retrieve the next request page.
///
/// [google.cloud.resourcemanager.v3.Projects.SearchProjects]: crate::client::Projects::search_projects
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchProjectsResponse {
    /// The list of Projects that matched the list filter query. This list can
    /// be paginated.
    pub projects: std::vec::Vec<crate::model::Project>,

    /// Pagination token.
    ///
    /// If the result set is too large to fit in a single response, this token
    /// is returned. It encodes the position of the current result cursor.
    /// Feeding this value into a new list request with the `page_token` parameter
    /// gives the next page of the results.
    ///
    /// When `next_page_token` is not filled in, there is no next page and
    /// the list returned is the last page in the result set.
    ///
    /// Pagination tokens have a limited lifetime.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchProjectsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [projects][crate::model::SearchProjectsResponse::projects].
    pub fn set_projects<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Project>,
    {
        use std::iter::Iterator;
        self.projects = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::SearchProjectsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchProjectsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.SearchProjectsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for SearchProjectsResponse {
    type PageItem = crate::model::Project;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.projects
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request sent to the
/// [CreateProject][google.cloud.resourcemanager.v3.Projects.CreateProject]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.CreateProject]: crate::client::Projects::create_project
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateProjectRequest {
    /// Required. The Project to create.
    ///
    /// Project ID is required. If the requested ID is unavailable, the request
    /// fails.
    ///
    /// If the `parent` field is set, the `resourcemanager.projects.create`
    /// permission is checked on the parent resource. If no parent is set and
    /// the authorization credentials belong to an Organization, the parent
    /// will be set to that Organization.
    pub project: std::option::Option<crate::model::Project>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [project][crate::model::CreateProjectRequest::project].
    pub fn set_project<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Project>,
    {
        self.project = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [project][crate::model::CreateProjectRequest::project].
    pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Project>,
    {
        self.project = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateProjectRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by CreateProject. It provides insight for when significant phases of
/// Project creation have completed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateProjectMetadata {
    /// Creation time of the project creation workflow.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// True if the project can be retrieved using `GetProject`. No other
    /// operations on the project are guaranteed to work until the project creation
    /// is complete.
    pub gettable: bool,

    /// True if the project creation process is complete.
    pub ready: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateProjectMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::CreateProjectMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::CreateProjectMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [gettable][crate::model::CreateProjectMetadata::gettable].
    pub fn set_gettable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.gettable = v.into();
        self
    }

    /// Sets the value of [ready][crate::model::CreateProjectMetadata::ready].
    pub fn set_ready<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.ready = v.into();
        self
    }
}

impl wkt::message::Message for CreateProjectMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateProjectMetadata"
    }
}

/// The request sent to the
/// [UpdateProject][google.cloud.resourcemanager.v3.Projects.UpdateProject]
/// method.
///
/// Only the `display_name` and `labels` fields can be change. Use the
/// [MoveProject][google.cloud.resourcemanager.v3.Projects.MoveProject] method to
/// change the `parent` field.
///
/// [google.cloud.resourcemanager.v3.Projects.MoveProject]: crate::client::Projects::move_project
/// [google.cloud.resourcemanager.v3.Projects.UpdateProject]: crate::client::Projects::update_project
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateProjectRequest {
    /// Required. The new definition of the project.
    pub project: std::option::Option<crate::model::Project>,

    /// Optional. An update mask to selectively update fields.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [project][crate::model::UpdateProjectRequest::project].
    pub fn set_project<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Project>,
    {
        self.project = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [project][crate::model::UpdateProjectRequest::project].
    pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Project>,
    {
        self.project = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateProjectRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateProjectRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateProjectRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by UpdateProject.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateProjectMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateProjectMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UpdateProjectMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateProjectMetadata"
    }
}

/// The request sent to
/// [MoveProject][google.cloud.resourcemanager.v3.Projects.MoveProject]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.MoveProject]: crate::client::Projects::move_project
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveProjectRequest {
    /// Required. The name of the project to move.
    pub name: std::string::String,

    /// Required. The new parent to move the Project under.
    pub destination_parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MoveProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::MoveProjectRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination_parent][crate::model::MoveProjectRequest::destination_parent].
    pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_parent = v.into();
        self
    }
}

impl wkt::message::Message for MoveProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.MoveProjectRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by MoveProject.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveProjectMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MoveProjectMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for MoveProjectMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.MoveProjectMetadata"
    }
}

/// [DeleteProject][google.cloud.resourcemanager.v3.Projects.DeleteProject]
/// method.
///
/// [google.cloud.resourcemanager.v3.Projects.DeleteProject]: crate::client::Projects::delete_project
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProjectRequest {
    /// Required. The name of the Project (for example, `projects/415104041262`).
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteProjectRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteProjectRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by `DeleteProject`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProjectMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProjectMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteProjectMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteProjectMetadata"
    }
}

/// The request sent to the [UndeleteProject]
/// [google.cloud.resourcemanager.v3.Projects.UndeleteProject]
/// method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteProjectRequest {
    /// Required. The name of the project (for example, `projects/415104041262`).
    ///
    /// Required.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteProjectRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UndeleteProjectRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for UndeleteProjectRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UndeleteProjectRequest"
    }
}

/// A status object which is used as the `metadata` field for the Operation
/// returned by `UndeleteProject`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteProjectMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteProjectMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UndeleteProjectMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UndeleteProjectMetadata"
    }
}

/// A TagBinding represents a connection between a TagValue and a cloud
/// resource Once a TagBinding is created, the TagValue is applied to all the
/// descendants of the Google Cloud resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TagBinding {
    /// Output only. The name of the TagBinding. This is a String of the form:
    /// `tagBindings/{full-resource-name}/{tag-value-name}` (e.g.
    /// `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`).
    pub name: std::string::String,

    /// The full resource name of the resource the TagValue is bound to.
    /// E.g. `//cloudresourcemanager.googleapis.com/projects/123`
    pub parent: std::string::String,

    /// The TagValue of the TagBinding.
    /// Must be of the form `tagValues/456`.
    pub tag_value: std::string::String,

    /// The namespaced name for the TagValue of the TagBinding.
    /// Must be in the format
    /// `{parent_id}/{tag_key_short_name}/{short_name}`.
    ///
    /// For methods that support TagValue namespaced name, only one of
    /// tag_value_namespaced_name or tag_value may be filled. Requests with both
    /// fields will be rejected.
    pub tag_value_namespaced_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TagBinding {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TagBinding::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::TagBinding::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [tag_value][crate::model::TagBinding::tag_value].
    pub fn set_tag_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tag_value = v.into();
        self
    }

    /// Sets the value of [tag_value_namespaced_name][crate::model::TagBinding::tag_value_namespaced_name].
    pub fn set_tag_value_namespaced_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.tag_value_namespaced_name = v.into();
        self
    }
}

impl wkt::message::Message for TagBinding {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.TagBinding"
    }
}

/// Runtime operation information for creating a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagBindingMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagBindingMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for CreateTagBindingMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagBindingMetadata"
    }
}

/// The request message to create a TagBinding.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagBindingRequest {
    /// Required. The TagBinding to be created.
    pub tag_binding: std::option::Option<crate::model::TagBinding>,

    /// Optional. Set to true to perform the validations necessary for creating the
    /// resource, but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_binding][crate::model::CreateTagBindingRequest::tag_binding].
    pub fn set_tag_binding<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagBinding>,
    {
        self.tag_binding = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_binding][crate::model::CreateTagBindingRequest::tag_binding].
    pub fn set_or_clear_tag_binding<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagBinding>,
    {
        self.tag_binding = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreateTagBindingRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreateTagBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagBindingRequest"
    }
}

/// Runtime operation information for deleting a TagBinding.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagBindingMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagBindingMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteTagBindingMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagBindingMetadata"
    }
}

/// The request message to delete a TagBinding.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagBindingRequest {
    /// Required. The name of the TagBinding. This is a String of the form:
    /// `tagBindings/{id}` (e.g.
    /// `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`).
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTagBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTagBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagBindingRequest"
    }
}

/// The request message to list all TagBindings for a parent.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagBindingsRequest {
    /// Required. The full resource name of a resource for which you want to list
    /// existing TagBindings. E.g.
    /// "//cloudresourcemanager.googleapis.com/projects/123"
    pub parent: std::string::String,

    /// Optional. The maximum number of TagBindings to return in the response. The
    /// server allows a maximum of 300 TagBindings to return. If unspecified, the
    /// server will use 100 as the default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `ListTagBindings` that indicates where this listing should continue from.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTagBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTagBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTagBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagBindingsRequest"
    }
}

/// The ListTagBindings response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagBindingsResponse {
    /// A possibly paginated list of TagBindings for the specified resource.
    pub tag_bindings: std::vec::Vec<crate::model::TagBinding>,

    /// Pagination token.
    ///
    /// If the result set is too large to fit in a single response, this token
    /// is returned. It encodes the position of the current result cursor.
    /// Feeding this value into a new list request with the `page_token` parameter
    /// gives the next page of the results.
    ///
    /// When `next_page_token` is not filled in, there is no next page and
    /// the list returned is the last page in the result set.
    ///
    /// Pagination tokens have a limited lifetime.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_bindings][crate::model::ListTagBindingsResponse::tag_bindings].
    pub fn set_tag_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TagBinding>,
    {
        use std::iter::Iterator;
        self.tag_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTagBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTagBindingsResponse {
    type PageItem = crate::model::TagBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tag_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message to ListEffectiveTags
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEffectiveTagsRequest {
    /// Required. The full resource name of a resource for which you want to list
    /// the effective tags. E.g.
    /// "//cloudresourcemanager.googleapis.com/projects/123"
    pub parent: std::string::String,

    /// Optional. The maximum number of effective tags to return in the response.
    /// The server allows a maximum of 300 effective tags to return in a single
    /// page. If unspecified, the server will use 100 as the default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `ListEffectiveTags` that indicates from where this listing should continue.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEffectiveTagsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListEffectiveTagsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListEffectiveTagsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListEffectiveTagsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListEffectiveTagsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListEffectiveTagsRequest"
    }
}

/// The response of ListEffectiveTags.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEffectiveTagsResponse {
    /// A possibly paginated list of effective tags for the specified resource.
    pub effective_tags: std::vec::Vec<crate::model::EffectiveTag>,

    /// Pagination token.
    ///
    /// If the result set is too large to fit in a single response, this token
    /// is returned. It encodes the position of the current result cursor.
    /// Feeding this value into a new list request with the `page_token` parameter
    /// gives the next page of the results.
    ///
    /// When `next_page_token` is not filled in, there is no next page and
    /// the list returned is the last page in the result set.
    ///
    /// Pagination tokens have a limited lifetime.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEffectiveTagsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [effective_tags][crate::model::ListEffectiveTagsResponse::effective_tags].
    pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::EffectiveTag>,
    {
        use std::iter::Iterator;
        self.effective_tags = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListEffectiveTagsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListEffectiveTagsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListEffectiveTagsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListEffectiveTagsResponse {
    type PageItem = crate::model::EffectiveTag;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.effective_tags
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// An EffectiveTag represents a tag that applies to a resource during policy
/// evaluation. Tags can be either directly bound to a resource or inherited from
/// its ancestor. EffectiveTag contains the name and
/// namespaced_name of the tag value and tag key, with additional fields of
/// `inherited` to indicate the inheritance status of the effective tag.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EffectiveTag {
    /// Resource name for TagValue in the format `tagValues/456`.
    pub tag_value: std::string::String,

    /// The namespaced name of the TagValue. Can be in the form
    /// `{organization_id}/{tag_key_short_name}/{tag_value_short_name}` or
    /// `{project_id}/{tag_key_short_name}/{tag_value_short_name}` or
    /// `{project_number}/{tag_key_short_name}/{tag_value_short_name}`.
    pub namespaced_tag_value: std::string::String,

    /// The name of the TagKey, in the format `tagKeys/{id}`, such as
    /// `tagKeys/123`.
    pub tag_key: std::string::String,

    /// The namespaced name of the TagKey. Can be in the form
    /// `{organization_id}/{tag_key_short_name}` or
    /// `{project_id}/{tag_key_short_name}` or
    /// `{project_number}/{tag_key_short_name}`.
    pub namespaced_tag_key: std::string::String,

    /// The parent name of the tag key.
    /// Must be in the format `organizations/{organization_id}` or
    /// `projects/{project_number}`
    pub tag_key_parent_name: std::string::String,

    /// Indicates the inheritance status of a tag value
    /// attached to the given resource. If the tag value is inherited from one of
    /// the resource's ancestors, inherited will be true. If false, then the tag
    /// value is directly attached to the resource, inherited will be false.
    pub inherited: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EffectiveTag {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_value][crate::model::EffectiveTag::tag_value].
    pub fn set_tag_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tag_value = v.into();
        self
    }

    /// Sets the value of [namespaced_tag_value][crate::model::EffectiveTag::namespaced_tag_value].
    pub fn set_namespaced_tag_value<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_tag_value = v.into();
        self
    }

    /// Sets the value of [tag_key][crate::model::EffectiveTag::tag_key].
    pub fn set_tag_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tag_key = v.into();
        self
    }

    /// Sets the value of [namespaced_tag_key][crate::model::EffectiveTag::namespaced_tag_key].
    pub fn set_namespaced_tag_key<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_tag_key = v.into();
        self
    }

    /// Sets the value of [tag_key_parent_name][crate::model::EffectiveTag::tag_key_parent_name].
    pub fn set_tag_key_parent_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.tag_key_parent_name = v.into();
        self
    }

    /// Sets the value of [inherited][crate::model::EffectiveTag::inherited].
    pub fn set_inherited<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.inherited = v.into();
        self
    }
}

impl wkt::message::Message for EffectiveTag {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.EffectiveTag"
    }
}

/// A TagHold represents the use of a TagValue that is not captured by
/// TagBindings. If a TagValue has any TagHolds, deletion will be blocked.
/// This resource is intended to be created in the same cloud location as the
/// `holder`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TagHold {
    /// Output only. The resource name of a TagHold. This is a String of the form:
    /// `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`
    /// (e.g. `tagValues/123/tagHolds/456`). This resource name is generated by
    /// the server.
    pub name: std::string::String,

    /// Required. The name of the resource where the TagValue is being used. Must
    /// be less than 200 characters. E.g.
    /// `//compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group`
    pub holder: std::string::String,

    /// Optional. An optional string representing the origin of this request. This
    /// field should include human-understandable information to distinguish
    /// origins from each other. Must be less than 200 characters. E.g.
    /// `migs-35678234`
    pub origin: std::string::String,

    /// Optional. A URL where an end user can learn more about removing this hold.
    /// E.g.
    /// `<https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing>`
    pub help_link: std::string::String,

    /// Output only. The time this TagHold was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TagHold {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TagHold::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [holder][crate::model::TagHold::holder].
    pub fn set_holder<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.holder = v.into();
        self
    }

    /// Sets the value of [origin][crate::model::TagHold::origin].
    pub fn set_origin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.origin = v.into();
        self
    }

    /// Sets the value of [help_link][crate::model::TagHold::help_link].
    pub fn set_help_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.help_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::TagHold::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::TagHold::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TagHold {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.TagHold"
    }
}

/// The request message to create a TagHold.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagHoldRequest {
    /// Required. The resource name of the TagHold's parent TagValue. Must be of
    /// the form: `tagValues/{tag-value-id}`.
    pub parent: std::string::String,

    /// Required. The TagHold to be created.
    pub tag_hold: std::option::Option<crate::model::TagHold>,

    /// Optional. Set to true to perform the validations necessary for creating the
    /// resource, but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagHoldRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateTagHoldRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [tag_hold][crate::model::CreateTagHoldRequest::tag_hold].
    pub fn set_tag_hold<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagHold>,
    {
        self.tag_hold = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_hold][crate::model::CreateTagHoldRequest::tag_hold].
    pub fn set_or_clear_tag_hold<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagHold>,
    {
        self.tag_hold = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreateTagHoldRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreateTagHoldRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagHoldRequest"
    }
}

/// Runtime operation information for creating a TagHold.
/// (-- The metadata is currently empty, but may include information in the
/// future. --)
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagHoldMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagHoldMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for CreateTagHoldMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagHoldMetadata"
    }
}

/// The request message to delete a TagHold.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagHoldRequest {
    /// Required. The resource name of the TagHold to delete. Must be of the form:
    /// `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`.
    pub name: std::string::String,

    /// Optional. Set to true to perform the validations necessary for deleting the
    /// resource, but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagHoldRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTagHoldRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeleteTagHoldRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTagHoldRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagHoldRequest"
    }
}

/// Runtime operation information for deleting a TagHold.
/// (-- The metadata is currently empty, but may include information in the
/// future. --)
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagHoldMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagHoldMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteTagHoldMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagHoldMetadata"
    }
}

/// The request message for listing the TagHolds under a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagHoldsRequest {
    /// Required. The resource name of the parent TagValue. Must be of the form:
    /// `tagValues/{tag-value-id}`.
    pub parent: std::string::String,

    /// Optional. The maximum number of TagHolds to return in the response. The
    /// server allows a maximum of 300 TagHolds to return. If unspecified, the
    /// server will use 100 as the default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `ListTagHolds` that indicates where this listing should continue from.
    pub page_token: std::string::String,

    /// Optional. Criteria used to select a subset of TagHolds parented by the
    /// TagValue to return. This field follows the syntax defined by aip.dev/160;
    /// the `holder` and `origin` fields are supported for filtering. Currently
    /// only `AND` syntax is supported. Some example queries are:
    ///
    /// * `holder =
    ///   //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group`
    /// * `origin = 35678234`
    /// * `holder =
    ///   //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group
    ///   AND origin = 35678234`
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagHoldsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTagHoldsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTagHoldsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTagHoldsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListTagHoldsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListTagHoldsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagHoldsRequest"
    }
}

/// The ListTagHolds response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagHoldsResponse {
    /// A possibly paginated list of TagHolds.
    pub tag_holds: std::vec::Vec<crate::model::TagHold>,

    /// Pagination token.
    ///
    /// If the result set is too large to fit in a single response, this token
    /// is returned. It encodes the position of the current result cursor.
    /// Feeding this value into a new list request with the `page_token` parameter
    /// gives the next page of the results.
    ///
    /// When `next_page_token` is not filled in, there is no next page and
    /// the list returned is the last page in the result set.
    ///
    /// Pagination tokens have a limited lifetime.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagHoldsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_holds][crate::model::ListTagHoldsResponse::tag_holds].
    pub fn set_tag_holds<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TagHold>,
    {
        use std::iter::Iterator;
        self.tag_holds = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTagHoldsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagHoldsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagHoldsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTagHoldsResponse {
    type PageItem = crate::model::TagHold;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tag_holds
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A TagKey, used to group a set of TagValues.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TagKey {
    /// Immutable. The resource name for a TagKey. Must be in the format
    /// `tagKeys/{tag_key_id}`, where `tag_key_id` is the generated numeric id for
    /// the TagKey.
    pub name: std::string::String,

    /// Immutable. The resource name of the TagKey's parent. A TagKey can be
    /// parented by an Organization or a Project. For a TagKey parented by an
    /// Organization, its parent must be in the form `organizations/{org_id}`. For
    /// a TagKey parented by a Project, its parent can be in the form
    /// `projects/{project_id}` or `projects/{project_number}`.
    pub parent: std::string::String,

    /// Required. Immutable. The user friendly name for a TagKey. The short name
    /// should be unique for TagKeys within the same tag namespace.
    ///
    /// The short name must be 1-63 characters, beginning and ending with
    /// an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_),
    /// dots (.), and alphanumerics between.
    pub short_name: std::string::String,

    /// Output only. Immutable. Namespaced name of the TagKey.
    pub namespaced_name: std::string::String,

    /// Optional. User-assigned description of the TagKey. Must not exceed 256
    /// characters.
    ///
    /// Read-write.
    pub description: std::string::String,

    /// Output only. Creation time.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Update time.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Entity tag which users can pass to prevent race conditions. This
    /// field is always set in server responses. See UpdateTagKeyRequest for
    /// details.
    pub etag: std::string::String,

    /// Optional. A purpose denotes that this Tag is intended for use in policies
    /// of a specific policy engine, and will involve that policy engine in
    /// management operations involving this Tag. A purpose does not grant a
    /// policy engine exclusive rights to the Tag, and it may be referenced by
    /// other policy engines.
    ///
    /// A purpose cannot be changed once set.
    pub purpose: crate::model::Purpose,

    /// Optional. Purpose data corresponds to the policy system that the tag is
    /// intended for. See documentation for `Purpose` for formatting of this field.
    ///
    /// Purpose data cannot be changed once set.
    pub purpose_data: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TagKey {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TagKey::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::TagKey::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [short_name][crate::model::TagKey::short_name].
    pub fn set_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.short_name = v.into();
        self
    }

    /// Sets the value of [namespaced_name][crate::model::TagKey::namespaced_name].
    pub fn set_namespaced_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.namespaced_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::TagKey::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::TagKey::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::TagKey::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::TagKey::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::TagKey::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::TagKey::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [purpose][crate::model::TagKey::purpose].
    pub fn set_purpose<T: std::convert::Into<crate::model::Purpose>>(mut self, v: T) -> Self {
        self.purpose = v.into();
        self
    }

    /// Sets the value of [purpose_data][crate::model::TagKey::purpose_data].
    pub fn set_purpose_data<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.purpose_data = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for TagKey {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.TagKey"
    }
}

/// The request message for listing all TagKeys under a parent resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagKeysRequest {
    /// Required. The resource name of the TagKey's parent.
    /// Must be of the form `organizations/{org_id}` or `projects/{project_id}` or
    /// `projects/{project_number}`
    pub parent: std::string::String,

    /// Optional. The maximum number of TagKeys to return in the response. The
    /// server allows a maximum of 300 TagKeys to return. If unspecified, the
    /// server will use 100 as the default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to `ListTagKey`
    /// that indicates where this listing should continue from.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagKeysRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTagKeysRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTagKeysRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTagKeysRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagKeysRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagKeysRequest"
    }
}

/// The ListTagKeys response message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagKeysResponse {
    /// List of TagKeys that live under the specified parent in the request.
    pub tag_keys: std::vec::Vec<crate::model::TagKey>,

    /// A pagination token returned from a previous call to `ListTagKeys`
    /// that indicates from where listing should continue.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagKeysResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_keys][crate::model::ListTagKeysResponse::tag_keys].
    pub fn set_tag_keys<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TagKey>,
    {
        use std::iter::Iterator;
        self.tag_keys = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTagKeysResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagKeysResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagKeysResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTagKeysResponse {
    type PageItem = crate::model::TagKey;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tag_keys
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for getting a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTagKeyRequest {
    /// Required. A resource name in the format `tagKeys/{id}`, such as
    /// `tagKeys/123`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetTagKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetTagKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetTagKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetTagKeyRequest"
    }
}

/// The request message for getting a TagKey by its namespaced name.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetNamespacedTagKeyRequest {
    /// Required. A namespaced tag key name in the format
    /// `{parentId}/{tagKeyShort}`, such as `42/foo` for a key with short name
    /// "foo" under the organization with ID 42 or `r2-d2/bar` for a key with short
    /// name "bar" under the project `r2-d2`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetNamespacedTagKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetNamespacedTagKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetNamespacedTagKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetNamespacedTagKeyRequest"
    }
}

/// The request message for creating a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagKeyRequest {
    /// Required. The TagKey to be created. Only fields `short_name`,
    /// `description`, and `parent` are considered during the creation request.
    pub tag_key: std::option::Option<crate::model::TagKey>,

    /// Optional. Set to true to perform validations necessary for creating the
    /// resource, but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_key][crate::model::CreateTagKeyRequest::tag_key].
    pub fn set_tag_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagKey>,
    {
        self.tag_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_key][crate::model::CreateTagKeyRequest::tag_key].
    pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagKey>,
    {
        self.tag_key = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreateTagKeyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreateTagKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagKeyRequest"
    }
}

/// Runtime operation information for creating a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagKeyMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagKeyMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for CreateTagKeyMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagKeyMetadata"
    }
}

/// The request message for updating a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTagKeyRequest {
    /// Required. The new definition of the TagKey. Only the `description` and
    /// `etag` fields can be updated by this request. If the `etag` field is not
    /// empty, it must match the `etag` field of the existing tag key. Otherwise,
    /// `ABORTED` will be returned.
    pub tag_key: std::option::Option<crate::model::TagKey>,

    /// Fields to be updated. The mask may only contain `description` or
    /// `etag`. If omitted entirely, both `description` and `etag` are assumed to
    /// be significant.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Set as true to perform validations necessary for updating the resource, but
    /// not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTagKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_key][crate::model::UpdateTagKeyRequest::tag_key].
    pub fn set_tag_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagKey>,
    {
        self.tag_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_key][crate::model::UpdateTagKeyRequest::tag_key].
    pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagKey>,
    {
        self.tag_key = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateTagKeyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateTagKeyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::UpdateTagKeyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for UpdateTagKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateTagKeyRequest"
    }
}

/// Runtime operation information for updating a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTagKeyMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTagKeyMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UpdateTagKeyMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateTagKeyMetadata"
    }
}

/// The request message for deleting a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagKeyRequest {
    /// Required. The resource name of a TagKey to be deleted in the format
    /// `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or
    /// it will not be deleted successfully.
    pub name: std::string::String,

    /// Optional. Set as true to perform validations necessary for deletion, but
    /// not actually perform the action.
    pub validate_only: bool,

    /// Optional. The etag known to the client for the expected state of the
    /// TagKey. This is to be used for optimistic concurrency.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTagKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeleteTagKeyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteTagKeyRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTagKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagKeyRequest"
    }
}

/// Runtime operation information for deleting a TagKey.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagKeyMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagKeyMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteTagKeyMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagKeyMetadata"
    }
}

/// A TagValue is a child of a particular TagKey. This is used to group
/// cloud resources for the purpose of controlling them using policies.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TagValue {
    /// Immutable. Resource name for TagValue in the format `tagValues/456`.
    pub name: std::string::String,

    /// Immutable. The resource name of the new TagValue's parent TagKey.
    /// Must be of the form `tagKeys/{tag_key_id}`.
    pub parent: std::string::String,

    /// Required. Immutable. User-assigned short name for TagValue. The short name
    /// should be unique for TagValues within the same parent TagKey.
    ///
    /// The short name must be 63 characters or less, beginning and ending with
    /// an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_),
    /// dots (.), and alphanumerics between.
    pub short_name: std::string::String,

    /// Output only. The namespaced name of the TagValue. Can be in the form
    /// `{organization_id}/{tag_key_short_name}/{tag_value_short_name}` or
    /// `{project_id}/{tag_key_short_name}/{tag_value_short_name}` or
    /// `{project_number}/{tag_key_short_name}/{tag_value_short_name}`.
    pub namespaced_name: std::string::String,

    /// Optional. User-assigned description of the TagValue.
    /// Must not exceed 256 characters.
    ///
    /// Read-write.
    pub description: std::string::String,

    /// Output only. Creation time.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Update time.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Entity tag which users can pass to prevent race conditions. This
    /// field is always set in server responses. See UpdateTagValueRequest for
    /// details.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TagValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TagValue::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::TagValue::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [short_name][crate::model::TagValue::short_name].
    pub fn set_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.short_name = v.into();
        self
    }

    /// Sets the value of [namespaced_name][crate::model::TagValue::namespaced_name].
    pub fn set_namespaced_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.namespaced_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::TagValue::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::TagValue::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::TagValue::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::TagValue::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::TagValue::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::TagValue::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for TagValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.TagValue"
    }
}

/// The request message for listing TagValues for the specified TagKey.
/// Resource name for TagKey, parent of the TagValues to be listed,
/// in the format `tagKeys/123`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagValuesRequest {
    /// Required.
    pub parent: std::string::String,

    /// Optional. The maximum number of TagValues to return in the response. The
    /// server allows a maximum of 300 TagValues to return. If unspecified, the
    /// server will use 100 as the default.
    pub page_size: i32,

    /// Optional. A pagination token returned from a previous call to
    /// `ListTagValues` that indicates where this listing should continue from.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagValuesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTagValuesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTagValuesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTagValuesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagValuesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagValuesRequest"
    }
}

/// The ListTagValues response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTagValuesResponse {
    /// A possibly paginated list of TagValues that are direct descendants of
    /// the specified parent TagKey.
    pub tag_values: std::vec::Vec<crate::model::TagValue>,

    /// A pagination token returned from a previous call to `ListTagValues`
    /// that indicates from where listing should continue. This is currently not
    /// used, but the server may at any point start supplying a valid token.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTagValuesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_values][crate::model::ListTagValuesResponse::tag_values].
    pub fn set_tag_values<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TagValue>,
    {
        use std::iter::Iterator;
        self.tag_values = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTagValuesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListTagValuesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.ListTagValuesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTagValuesResponse {
    type PageItem = crate::model::TagValue;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tag_values
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for getting a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTagValueRequest {
    /// Required. Resource name for TagValue to be fetched in the format
    /// `tagValues/456`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetTagValueRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetTagValueRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetTagValueRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetTagValueRequest"
    }
}

/// The request message for getting a TagValue by its namespaced name.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetNamespacedTagValueRequest {
    /// Required. A namespaced tag value name in the following format:
    ///
    /// `{parentId}/{tagKeyShort}/{tagValueShort}`
    ///
    /// Examples:
    ///
    /// - `42/foo/abc` for a value with short name "abc" under the key with short
    ///   name "foo" under the organization with ID 42
    /// - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with
    ///   short name "bar" under the project with ID "r2-d2"
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetNamespacedTagValueRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetNamespacedTagValueRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetNamespacedTagValueRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.GetNamespacedTagValueRequest"
    }
}

/// The request message for creating a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagValueRequest {
    /// Required. The TagValue to be created. Only fields `short_name`,
    /// `description`, and `parent` are considered during the creation request.
    pub tag_value: std::option::Option<crate::model::TagValue>,

    /// Optional. Set as true to perform the validations necessary for creating the
    /// resource, but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagValueRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_value][crate::model::CreateTagValueRequest::tag_value].
    pub fn set_tag_value<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagValue>,
    {
        self.tag_value = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_value][crate::model::CreateTagValueRequest::tag_value].
    pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagValue>,
    {
        self.tag_value = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreateTagValueRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreateTagValueRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagValueRequest"
    }
}

/// Runtime operation information for creating a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTagValueMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTagValueMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for CreateTagValueMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.CreateTagValueMetadata"
    }
}

/// The request message for updating a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTagValueRequest {
    /// Required. The new definition of the TagValue. Only fields `description` and
    /// `etag` fields can be updated by this request. If the `etag` field is
    /// nonempty, it must match the `etag` field of the existing ControlGroup.
    /// Otherwise, `ABORTED` will be returned.
    pub tag_value: std::option::Option<crate::model::TagValue>,

    /// Optional. Fields to be updated.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Optional. True to perform validations necessary for updating the resource,
    /// but not actually perform the action.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTagValueRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tag_value][crate::model::UpdateTagValueRequest::tag_value].
    pub fn set_tag_value<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TagValue>,
    {
        self.tag_value = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tag_value][crate::model::UpdateTagValueRequest::tag_value].
    pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TagValue>,
    {
        self.tag_value = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateTagValueRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateTagValueRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::UpdateTagValueRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for UpdateTagValueRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateTagValueRequest"
    }
}

/// Runtime operation information for updating a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTagValueMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTagValueMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UpdateTagValueMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.UpdateTagValueMetadata"
    }
}

/// The request message for deleting a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagValueRequest {
    /// Required. Resource name for TagValue to be deleted in the format
    /// tagValues/456.
    pub name: std::string::String,

    /// Optional. Set as true to perform the validations necessary for deletion,
    /// but not actually perform the action.
    pub validate_only: bool,

    /// Optional. The etag known to the client for the expected state of the
    /// TagValue. This is to be used for optimistic concurrency.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagValueRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTagValueRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeleteTagValueRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteTagValueRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTagValueRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagValueRequest"
    }
}

/// Runtime operation information for deleting a TagValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTagValueMetadata {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTagValueMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeleteTagValueMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.resourcemanager.v3.DeleteTagValueMetadata"
    }
}

/// A purpose for each policy engine requiring such an integration. A single
/// policy engine may have multiple purposes defined, however a TagKey may only
/// specify a single purpose.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Purpose {
    /// Unspecified purpose.
    Unspecified,
    /// Purpose for Compute Engine firewalls.
    /// A corresponding `purpose_data` should be set for the network the tag is
    /// intended for. The key should be `network` and the value should be in
    /// either of these two formats:
    ///
    ///
    /// `<https://www.googleapis.com/compute/{compute_version}/projects/{project_id}/global/networks/{network_id}>`
    ///
    /// - `{project_id}/{network_name}`
    ///
    /// Examples:
    ///
    ///
    /// `<https://www.googleapis.com/compute/staging_v1/projects/fail-closed-load-testing/global/networks/6992953698831725600>`
    ///
    /// - `fail-closed-load-testing/load-testing-network`
    GceFirewall,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [Purpose::value] or
    /// [Purpose::name].
    UnknownValue(purpose::UnknownValue),
}

#[doc(hidden)]
pub mod purpose {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl Purpose {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::GceFirewall => std::option::Option::Some(1),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("PURPOSE_UNSPECIFIED"),
            Self::GceFirewall => std::option::Option::Some("GCE_FIREWALL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for Purpose {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for Purpose {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for Purpose {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::GceFirewall,
            _ => Self::UnknownValue(purpose::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for Purpose {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "PURPOSE_UNSPECIFIED" => Self::Unspecified,
            "GCE_FIREWALL" => Self::GceFirewall,
            _ => Self::UnknownValue(purpose::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for Purpose {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::GceFirewall => serializer.serialize_i32(1),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for Purpose {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Purpose>::new(
            ".google.cloud.resourcemanager.v3.Purpose",
        ))
    }
}
